<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>JSON::PP - JSON::XS compatible pure-Perl module. - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/JSON::PP">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./JSON::PP.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/JSON::PP">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/JSON::PP">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/JSON::PP">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/JSON::PP">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/JSON::PP">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/JSON::PP">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/JSON::PP">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/JSON::PP">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/JSON::PP">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/JSON::PP">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/JSON::PP">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/JSON::PP">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/JSON::PP">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/JSON::PP">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/JSON::PP">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/JSON::PP">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/JSON::PP">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/JSON::PP">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/JSON::PP">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/JSON::PP">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/JSON::PP">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/JSON::PP">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/JSON::PP">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/JSON::PP">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/JSON::PP">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/JSON::PP">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/JSON::PP">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/JSON::PP">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/JSON::PP">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/JSON::PP">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/JSON::PP">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/JSON::PP">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/JSON::PP">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/JSON::PP">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/JSON::PP">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/JSON::PP">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/JSON::PP">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/JSON::PP">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/JSON::PP">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/JSON::PP">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/JSON::PP">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/JSON::PP">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/JSON::PP">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/JSON::PP">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/JSON::PP">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/JSON::PP">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/JSON::PP">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/JSON::PP">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/JSON::PP">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/JSON::PP">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/JSON::PP">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/JSON::PP">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/JSON::PP">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/JSON::PP">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/JSON::PP">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/JSON::PP">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/JSON::PP">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/JSON::PP">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/JSON::PP">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/JSON::PP">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/JSON::PP">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/JSON::PP">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/JSON::PP">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/JSON::PP">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/JSON::PP">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/JSON::PP">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/JSON::PP">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/JSON::PP">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/JSON::PP">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/JSON::PP">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/JSON::PP">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/JSON::PP">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/JSON::PP">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/JSON::PP">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/JSON::PP">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/JSON::PP">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/JSON::PP">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/JSON::PP">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/JSON::PP">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/JSON::PP">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./JSON::PP.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/JSON::PP">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/JSON::PP">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/JSON::PP">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/JSON::PP">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/JSON::PP">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/JSON::PP">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/JSON::PP">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/JSON::PP">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/JSON::PP">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/JSON::PP">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/JSON::PP">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/JSON::PP">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/JSON::PP">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/JSON::PP">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/JSON::PP">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/JSON::PP">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/JSON::PP">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/JSON::PP">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/JSON::PP">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/JSON::PP">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/JSON::PP">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/JSON::PP">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/JSON::PP">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/JSON::PP">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/JSON::PP">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/JSON::PP">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/JSON::PP">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/JSON::PP">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/JSON::PP">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/JSON::PP">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/JSON::PP">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/JSON::PP">5.35.1</a>
          <a class="dropdown-item active" href="./JSON::PP.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./JSON::PP.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./JSON::PP.html">JSON::PP</a>
          <div id="more">
            (<a href="./JSON::PP.txt">source</a>,
            <a href="https://metacpan.org/pod/JSON::PP">CPAN</a>)
          </div>
            <div id="moduleversion">version 4.06</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#VERSION">VERSION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#FUNCTIONAL-INTERFACE">FUNCTIONAL INTERFACE</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#encode_json">encode_json</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#decode_json">decode_json</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#JSON::PP::is_bool">JSON::PP::is_bool</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#OBJECT-ORIENTED-INTERFACE">OBJECT-ORIENTED INTERFACE</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#new">new</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#ascii">ascii</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#latin1">latin1</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#utf8">utf8</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#pretty">pretty</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#indent">indent</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#space_before">space_before</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#space_after">space_after</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#relaxed">relaxed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#canonical">canonical</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#allow_nonref">allow_nonref</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#allow_unknown">allow_unknown</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#allow_blessed">allow_blessed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#convert_blessed">convert_blessed</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#allow_tags">allow_tags</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#boolean_values">boolean_values</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#filter_json_object">filter_json_object</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#filter_json_single_key_object">filter_json_single_key_object</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#shrink">shrink</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#max_depth">max_depth</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#max_size">max_size</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#encode">encode</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#decode">decode</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#decode_prefix">decode_prefix</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#FLAGS-FOR-JSON::PP-ONLY">FLAGS FOR JSON::PP ONLY</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#allow_singlequote">allow_singlequote</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#allow_barekey">allow_barekey</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#allow_bignum">allow_bignum</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#loose">loose</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#escape_slash">escape_slash</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#indent_length">indent_length</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#sort_by">sort_by</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#INCREMENTAL-PARSING">INCREMENTAL PARSING</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#incr_parse">incr_parse</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#incr_text">incr_text</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#incr_skip">incr_skip</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#incr_reset">incr_reset</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#MAPPING">MAPPING</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#JSON-%3E-PERL">JSON -&gt; PERL</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#PERL-%3E-JSON">PERL -&gt; JSON</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#OBJECT-SERIALISATION">OBJECT SERIALISATION</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#SERIALISATION">SERIALISATION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#DESERIALISATION">DESERIALISATION</a>
              </li>
          </ul>

              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#ENCODING/CODESET-FLAG-NOTES">ENCODING/CODESET FLAG NOTES</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#BUGS">BUGS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#SEE-ALSO">SEE ALSO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#CURRENT-MAINTAINER">CURRENT MAINTAINER</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./JSON::PP.html#COPYRIGHT-AND-LICENSE">COPYRIGHT AND LICENSE</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./JSON::PP.html#NAME">#</a>NAME</h1>

<p>JSON::PP - JSON::XS compatible pure-Perl module.</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./JSON::PP.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use JSON::PP;

# exported functions, they croak on error
# and expect/generate UTF-8

$utf8_encoded_json_text = encode_json $perl_hash_or_arrayref;
$perl_hash_or_arrayref  = decode_json $utf8_encoded_json_text;

# OO-interface

$json = JSON::PP-&gt;new-&gt;ascii-&gt;pretty-&gt;allow_nonref;

$pretty_printed_json_text = $json-&gt;encode( $perl_scalar );
$perl_scalar = $json-&gt;decode( $json_text );

# Note that JSON version 2.0 and above will automatically use
# JSON::XS or JSON::PP, so you should be able to just:

use JSON;</code></pre>

<h1 id="VERSION"><a class="permalink" href="./JSON::PP.html#VERSION">#</a>VERSION</h1>

<pre><code class="plaintext">4.05</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./JSON::PP.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>JSON::PP is a pure perl JSON decoder/encoder, and (almost) compatible to much faster <a href="./JSON::XS.html">JSON::XS</a> written by Marc Lehmann in C. JSON::PP works as a fallback module when you use <a href="JSON.html">JSON</a> module without having installed JSON::XS.</p>

<p>Because of this fallback feature of JSON.pm, JSON::PP tries not to be more JavaScript-friendly than JSON::XS (i.e. not to escape extra characters such as U+2028 and U+2029, etc), in order for you not to lose such JavaScript-friendliness silently when you use JSON.pm and install JSON::XS for speed or by accident. If you need JavaScript-friendly RFC7159-compliant pure perl module, try <a href="./JSON::Tiny.html">JSON::Tiny</a>, which is derived from <a href="Mojolicious.html">Mojolicious</a> web framework and is also smaller and faster than JSON::PP.</p>

<p>JSON::PP has been in the Perl core since Perl 5.14, mainly for CPAN toolchain modules to parse META.json.</p>

<h1 id="FUNCTIONAL-INTERFACE"><a class="permalink" href="./JSON::PP.html#FUNCTIONAL-INTERFACE">#</a><a id="FUNCTIONAL"></a>FUNCTIONAL INTERFACE</h1>

<p>This section is taken from JSON::XS almost verbatim. <code>encode_json</code> and <code>decode_json</code> are exported by default.</p>

<h2 id="encode_json"><a class="permalink" href="./JSON::PP.html#encode_json">#</a>encode_json</h2>

<pre><code>$json_text = encode_json $perl_scalar</code></pre>

<p>Converts the given Perl data structure to a UTF-8 encoded, binary string (that is, the string contains octets only). Croaks on error.</p>

<p>This function call is functionally identical to:</p>

<pre><code>$json_text = JSON::PP-&gt;new-&gt;utf8-&gt;encode($perl_scalar)</code></pre>

<p>Except being faster.</p>

<h2 id="decode_json"><a class="permalink" href="./JSON::PP.html#decode_json">#</a>decode_json</h2>

<pre><code>$perl_scalar = decode_json $json_text</code></pre>

<p>The opposite of <code>encode_json</code>: expects an UTF-8 (binary) string and tries to parse that as an UTF-8 encoded JSON text, returning the resulting reference. Croaks on error.</p>

<p>This function call is functionally identical to:</p>

<pre><code>$perl_scalar = JSON::PP-&gt;new-&gt;utf8-&gt;decode($json_text)</code></pre>

<p>Except being faster.</p>

<h2 id="JSON::PP::is_bool"><a class="permalink" href="./JSON::PP.html#JSON::PP::is_bool">#</a><a id="JSON"></a>JSON::PP::is_bool</h2>

<pre><code>$is_boolean = JSON::PP::is_bool($scalar)</code></pre>

<p>Returns true if the passed scalar represents either JSON::PP::true or JSON::PP::false, two constants that act like <code>1</code> and <code>0</code> respectively and are also used to represent JSON <code>true</code> and <code>false</code> in Perl strings.</p>

<p>See <a href="https://perldoc.perl.org/5.35.0/MAPPING">MAPPING</a>, below, for more information on how JSON values are mapped to Perl.</p>

<h1 id="OBJECT-ORIENTED-INTERFACE"><a class="permalink" href="./JSON::PP.html#OBJECT-ORIENTED-INTERFACE">#</a><a id="OBJECT"></a>OBJECT-ORIENTED INTERFACE</h1>

<p>This section is also taken from JSON::XS.</p>

<p>The object oriented interface lets you configure your own encoding or decoding style, within the limits of supported formats.</p>

<h2 id="new"><a class="permalink" href="./JSON::PP.html#new">#</a>new</h2>

<pre><code>$json = JSON::PP-&gt;new</code></pre>

<p>Creates a new JSON::PP object that can be used to de/encode JSON strings. All boolean flags described below are by default <i>disabled</i> (with the exception of <code>allow_nonref</code>, which defaults to <i>enabled</i> since version <code>4.0</code>).</p>

<p>The mutators for flags all return the JSON::PP object again and thus calls can be chained:</p>

<pre><code>my $json = JSON::PP-&gt;new-&gt;utf8-&gt;space_after-&gt;encode({a =&gt; [1,2]})
=&gt; {&quot;a&quot;: [1, 2]}</code></pre>

<h2 id="ascii"><a class="permalink" href="./JSON::PP.html#ascii">#</a>ascii</h2>

<pre><code>$json = $json-&gt;ascii([$enable])

$enabled = $json-&gt;get_ascii</code></pre>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will not generate characters outside the code range <code>0..127</code> (which is ASCII). Any Unicode characters outside that range will be escaped using either a single \uXXXX (BMP characters) or a double \uHHHH\uLLLLL escape sequence, as per RFC4627. The resulting encoded JSON text can be treated as a native Unicode string, an ascii-encoded, latin1-encoded or UTF-8 encoded string, or any other superset of ASCII.</p>

<p>If <code>$enable</code> is false, then the <code>encode</code> method will not escape Unicode characters unless required by the JSON syntax or other flags. This results in a faster and more compact format.</p>

<p>See also the section <i>ENCODING/CODESET FLAG NOTES</i> later in this document.</p>

<p>The main use for this flag is to produce JSON texts that can be transmitted over a 7-bit channel, as the encoded JSON texts will not contain any 8 bit characters.</p>

<pre><code>JSON::PP-&gt;new-&gt;ascii(1)-&gt;encode([chr 0x10401])
=&gt; [&quot;\ud801\udc01&quot;]</code></pre>

<h2 id="latin1"><a class="permalink" href="./JSON::PP.html#latin1">#</a>latin1</h2>

<pre><code>$json = $json-&gt;latin1([$enable])

$enabled = $json-&gt;get_latin1</code></pre>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will encode the resulting JSON text as latin1 (or iso-8859-1), escaping any characters outside the code range <code>0..255</code>. The resulting string can be treated as a latin1-encoded JSON text or a native Unicode string. The <code>decode</code> method will not be affected in any way by this flag, as <code>decode</code> by default expects Unicode, which is a strict superset of latin1.</p>

<p>If <code>$enable</code> is false, then the <code>encode</code> method will not escape Unicode characters unless required by the JSON syntax or other flags.</p>

<p>See also the section <i>ENCODING/CODESET FLAG NOTES</i> later in this document.</p>

<p>The main use for this flag is efficiently encoding binary data as JSON text, as most octets will not be escaped, resulting in a smaller encoded size. The disadvantage is that the resulting JSON text is encoded in latin1 (and must correctly be treated as such when storing and transferring), a rare encoding for JSON. It is therefore most useful when you want to store data structures known to contain binary data efficiently in files or databases, not when talking to other JSON encoders/decoders.</p>

<pre><code>JSON::PP-&gt;new-&gt;latin1-&gt;encode ([&quot;\x{89}\x{abc}&quot;]
=&gt; [&quot;\x{89}\\u0abc&quot;]    # (perl syntax, U+abc escaped, U+89 not)</code></pre>

<h2 id="utf8"><a class="permalink" href="./JSON::PP.html#utf8">#</a>utf8</h2>

<pre><code>$json = $json-&gt;utf8([$enable])

$enabled = $json-&gt;get_utf8</code></pre>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will encode the JSON result into UTF-8, as required by many protocols, while the <code>decode</code> method expects to be handled an UTF-8-encoded string. Please note that UTF-8-encoded strings do not contain any characters outside the range <code>0..255</code>, they are thus useful for bytewise/binary I/O. In future versions, enabling this option might enable autodetection of the UTF-16 and UTF-32 encoding families, as described in RFC4627.</p>

<p>If <code>$enable</code> is false, then the <code>encode</code> method will return the JSON string as a (non-encoded) Unicode string, while <code>decode</code> expects thus a Unicode string. Any decoding or encoding (e.g. to UTF-8 or UTF-16) needs to be done yourself, e.g. using the Encode module.</p>

<p>See also the section <i>ENCODING/CODESET FLAG NOTES</i> later in this document.</p>

<p>Example, output UTF-16BE-encoded JSON:</p>

<pre><code>use Encode;
$jsontext = encode &quot;UTF-16BE&quot;, JSON::PP-&gt;new-&gt;encode ($object);</code></pre>

<p>Example, decode UTF-32LE-encoded JSON:</p>

<pre><code>use Encode;
$object = JSON::PP-&gt;new-&gt;decode (decode &quot;UTF-32LE&quot;, $jsontext);</code></pre>

<h2 id="pretty"><a class="permalink" href="./JSON::PP.html#pretty">#</a>pretty</h2>

<pre><code>$json = $json-&gt;pretty([$enable])</code></pre>

<p>This enables (or disables) all of the <code>indent</code>, <code>space_before</code> and <code>space_after</code> (and in the future possibly more) flags in one call to generate the most readable (or most compact) form possible.</p>

<h2 id="indent"><a class="permalink" href="./JSON::PP.html#indent">#</a>indent</h2>

<pre><code>$json = $json-&gt;indent([$enable])

$enabled = $json-&gt;get_indent</code></pre>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will use a multiline format as output, putting every array member or object/hash key-value pair into its own line, indenting them properly.</p>

<p>If <code>$enable</code> is false, no newlines or indenting will be produced, and the resulting JSON text is guaranteed not to contain any <code>newlines</code>.</p>

<p>This setting has no effect when decoding JSON texts.</p>

<p>The default indent space length is three. You can use <code>indent_length</code> to change the length.</p>

<h2 id="space_before"><a class="permalink" href="./JSON::PP.html#space_before">#</a>space_before</h2>

<pre><code>$json = $json-&gt;space_before([$enable])

$enabled = $json-&gt;get_space_before</code></pre>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will add an extra optional space before the <code>:</code> separating keys from values in JSON objects.</p>

<p>If <code>$enable</code> is false, then the <code>encode</code> method will not add any extra space at those places.</p>

<p>This setting has no effect when decoding JSON texts. You will also most likely combine this setting with <code>space_after</code>.</p>

<p>Example, space_before enabled, space_after and indent disabled:</p>

<pre><code class="plaintext">{&quot;key&quot; :&quot;value&quot;}</code></pre>

<h2 id="space_after"><a class="permalink" href="./JSON::PP.html#space_after">#</a>space_after</h2>

<pre><code>$json = $json-&gt;space_after([$enable])

$enabled = $json-&gt;get_space_after</code></pre>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will add an extra optional space after the <code>:</code> separating keys from values in JSON objects and extra whitespace after the <code>,</code> separating key-value pairs and array members.</p>

<p>If <code>$enable</code> is false, then the <code>encode</code> method will not add any extra space at those places.</p>

<p>This setting has no effect when decoding JSON texts.</p>

<p>Example, space_before and indent disabled, space_after enabled:</p>

<pre><code class="plaintext">{&quot;key&quot;: &quot;value&quot;}</code></pre>

<h2 id="relaxed"><a class="permalink" href="./JSON::PP.html#relaxed">#</a>relaxed</h2>

<pre><code>$json = $json-&gt;relaxed([$enable])

$enabled = $json-&gt;get_relaxed</code></pre>

<p>If <code>$enable</code> is true (or missing), then <code>decode</code> will accept some extensions to normal JSON syntax (see below). <code>encode</code> will not be affected in anyway. <i>Be aware that this option makes you accept invalid JSON texts as if they were valid!</i>. I suggest only to use this option to parse application-specific files written by humans (configuration files, resource files etc.)</p>

<p>If <code>$enable</code> is false (the default), then <code>decode</code> will only accept valid JSON texts.</p>

<p>Currently accepted extensions are:</p>

<ul>

<li><p>list items can have an end-comma</p>

<p>JSON <i>separates</i> array elements and key-value pairs with commas. This can be annoying if you write JSON texts manually and want to be able to quickly append elements, so this extension accepts comma at the end of such items not just between them:</p>

<pre><code>[
   1,
   2, &lt;- this comma not normally allowed
]
{
   &quot;k1&quot;: &quot;v1&quot;,
   &quot;k2&quot;: &quot;v2&quot;, &lt;- this comma not normally allowed
}</code></pre>

</li>
<li><p>shell-style &#39;#&#39;-comments</p>

<p>Whenever JSON allows whitespace, shell-style comments are additionally allowed. They are terminated by the first carriage-return or line-feed character, after which more white-space and comments are allowed.</p>

<pre><code class="plaintext">[
   1, # this comment not allowed in JSON
      # neither this one...
]</code></pre>

</li>
<li><p>C-style multiple-line &#39;/* */&#39;-comments (JSON::PP only)</p>

<p>Whenever JSON allows whitespace, C-style multiple-line comments are additionally allowed. Everything between <code>/*</code> and <code>*/</code> is a comment, after which more white-space and comments are allowed.</p>

<pre><code class="plaintext">[
   1, /* this comment not allowed in JSON */
      /* neither this one... */
]</code></pre>

</li>
<li><p>C++-style one-line &#39;//&#39;-comments (JSON::PP only)</p>

<p>Whenever JSON allows whitespace, C++-style one-line comments are additionally allowed. They are terminated by the first carriage-return or line-feed character, after which more white-space and comments are allowed.</p>

<pre><code class="plaintext">[
   1, // this comment not allowed in JSON
      // neither this one...
]</code></pre>

</li>
<li><p>literal ASCII TAB characters in strings</p>

<p>Literal ASCII TAB characters are now allowed in strings (and treated as <code>\t</code>).</p>

<pre><code class="plaintext">[
   &quot;Hello\tWorld&quot;,
   &quot;Hello&lt;TAB&gt;World&quot;, # literal &lt;TAB&gt; would not normally be allowed
]</code></pre>

</li>
</ul>

<h2 id="canonical"><a class="permalink" href="./JSON::PP.html#canonical">#</a>canonical</h2>

<pre><code>$json = $json-&gt;canonical([$enable])

$enabled = $json-&gt;get_canonical</code></pre>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will output JSON objects by sorting their keys. This is adding a comparatively high overhead.</p>

<p>If <code>$enable</code> is false, then the <code>encode</code> method will output key-value pairs in the order Perl stores them (which will likely change between runs of the same script, and can change even within the same run from 5.18 onwards).</p>

<p>This option is useful if you want the same data structure to be encoded as the same JSON text (given the same overall settings). If it is disabled, the same hash might be encoded differently even if contains the same data, as key-value pairs have no inherent ordering in Perl.</p>

<p>This setting has no effect when decoding JSON texts.</p>

<p>This setting has currently no effect on tied hashes.</p>

<h2 id="allow_nonref"><a class="permalink" href="./JSON::PP.html#allow_nonref">#</a>allow_nonref</h2>

<pre><code>$json = $json-&gt;allow_nonref([$enable])

$enabled = $json-&gt;get_allow_nonref</code></pre>

<p>Unlike other boolean options, this opotion is enabled by default beginning with version <code>4.0</code>.</p>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method can convert a non-reference into its corresponding string, number or null JSON value, which is an extension to RFC4627. Likewise, <code>decode</code> will accept those JSON values instead of croaking.</p>

<p>If <code>$enable</code> is false, then the <code>encode</code> method will croak if it isn&#39;t passed an arrayref or hashref, as JSON texts must either be an object or array. Likewise, <code>decode</code> will croak if given something that is not a JSON object or array.</p>

<p>Example, encode a Perl scalar as JSON value without enabled <code>allow_nonref</code>, resulting in an error:</p>

<pre><code>JSON::PP-&gt;new-&gt;allow_nonref(0)-&gt;encode (&quot;Hello, World!&quot;)
=&gt; hash- or arrayref expected...</code></pre>

<h2 id="allow_unknown"><a class="permalink" href="./JSON::PP.html#allow_unknown">#</a>allow_unknown</h2>

<pre><code>$json = $json-&gt;allow_unknown([$enable])

$enabled = $json-&gt;get_allow_unknown</code></pre>

<p>If <code>$enable</code> is true (or missing), then <code>encode</code> will <i>not</i> throw an exception when it encounters values it cannot represent in JSON (for example, filehandles) but instead will encode a JSON <code>null</code> value. Note that blessed objects are not included here and are handled separately by c&lt;allow_blessed&gt;.</p>

<p>If <code>$enable</code> is false (the default), then <code>encode</code> will throw an exception when it encounters anything it cannot encode as JSON.</p>

<p>This option does not affect <code>decode</code> in any way, and it is recommended to leave it off unless you know your communications partner.</p>

<h2 id="allow_blessed"><a class="permalink" href="./JSON::PP.html#allow_blessed">#</a>allow_blessed</h2>

<pre><code>$json = $json-&gt;allow_blessed([$enable])

$enabled = $json-&gt;get_allow_blessed</code></pre>

<p>See <a href="./JSON::PP.html#OBJECT-SERIALISATION">&quot;OBJECT SERIALISATION&quot;</a> for details.</p>

<p>If <code>$enable</code> is true (or missing), then the <code>encode</code> method will not barf when it encounters a blessed reference that it cannot convert otherwise. Instead, a JSON <code>null</code> value is encoded instead of the object.</p>

<p>If <code>$enable</code> is false (the default), then <code>encode</code> will throw an exception when it encounters a blessed object that it cannot convert otherwise.</p>

<p>This setting has no effect on <code>decode</code>.</p>

<h2 id="convert_blessed"><a class="permalink" href="./JSON::PP.html#convert_blessed">#</a>convert_blessed</h2>

<pre><code>$json = $json-&gt;convert_blessed([$enable])

$enabled = $json-&gt;get_convert_blessed</code></pre>

<p>See <a href="./JSON::PP.html#OBJECT-SERIALISATION">&quot;OBJECT SERIALISATION&quot;</a> for details.</p>

<p>If <code>$enable</code> is true (or missing), then <code>encode</code>, upon encountering a blessed object, will check for the availability of the <code>TO_JSON</code> method on the object&#39;s class. If found, it will be called in scalar context and the resulting scalar will be encoded instead of the object.</p>

<p>The <code>TO_JSON</code> method may safely call die if it wants. If <code>TO_JSON</code> returns other blessed objects, those will be handled in the same way. <code>TO_JSON</code> must take care of not causing an endless recursion cycle (== crash) in this case. The name of <code>TO_JSON</code> was chosen because other methods called by the Perl core (== not by the user of the object) are usually in upper case letters and to avoid collisions with any <code>to_json</code> function or method.</p>

<p>If <code>$enable</code> is false (the default), then <code>encode</code> will not consider this type of conversion.</p>

<p>This setting has no effect on <code>decode</code>.</p>

<h2 id="allow_tags"><a class="permalink" href="./JSON::PP.html#allow_tags">#</a>allow_tags</h2>

<pre><code>$json = $json-&gt;allow_tags([$enable])

$enabled = $json-&gt;get_allow_tags</code></pre>

<p>See <a href="./JSON::PP.html#OBJECT-SERIALISATION">&quot;OBJECT SERIALISATION&quot;</a> for details.</p>

<p>If <code>$enable</code> is true (or missing), then <code>encode</code>, upon encountering a blessed object, will check for the availability of the <code>FREEZE</code> method on the object&#39;s class. If found, it will be used to serialise the object into a nonstandard tagged JSON value (that JSON decoders cannot decode).</p>

<p>It also causes <code>decode</code> to parse such tagged JSON values and deserialise them via a call to the <code>THAW</code> method.</p>

<p>If <code>$enable</code> is false (the default), then <code>encode</code> will not consider this type of conversion, and tagged JSON values will cause a parse error in <code>decode</code>, as if tags were not part of the grammar.</p>

<h2 id="boolean_values"><a class="permalink" href="./JSON::PP.html#boolean_values">#</a>boolean_values</h2>

<pre><code>$json-&gt;boolean_values([$false, $true])

($false,  $true) = $json-&gt;get_boolean_values</code></pre>

<p>By default, JSON booleans will be decoded as overloaded <code>$JSON::PP::false</code> and <code>$JSON::PP::true</code> objects.</p>

<p>With this method you can specify your own boolean values for decoding - on decode, JSON <code>false</code> will be decoded as a copy of <code>$false</code>, and JSON <code>true</code> will be decoded as <code>$true</code> (&quot;copy&quot; here is the same thing as assigning a value to another variable, i.e. <code>$copy = $false</code>).</p>

<p>This is useful when you want to pass a decoded data structure directly to other serialisers like YAML, Data::MessagePack and so on.</p>

<p>Note that this works only when you <code>decode</code>. You can set incompatible boolean objects (like <a href="boolean.html">boolean</a>), but when you <code>encode</code> a data structure with such boolean objects, you still need to enable <code>convert_blessed</code> (and add a <code>TO_JSON</code> method if necessary).</p>

<p>Calling this method without any arguments will reset the booleans to their default values.</p>

<p><code>get_boolean_values</code> will return both <code>$false</code> and <code>$true</code> values, or the empty list when they are set to the default.</p>

<h2 id="filter_json_object"><a class="permalink" href="./JSON::PP.html#filter_json_object">#</a>filter_json_object</h2>

<pre><code>$json = $json-&gt;filter_json_object([$coderef])</code></pre>

<p>When <code>$coderef</code> is specified, it will be called from <code>decode</code> each time it decodes a JSON object. The only argument is a reference to the newly-created hash. If the code references returns a single scalar (which need not be a reference), this value (or rather a copy of it) is inserted into the deserialised data structure. If it returns an empty list (NOTE: <i>not</i> <code>undef</code>, which is a valid scalar), the original deserialised hash will be inserted. This setting can slow down decoding considerably.</p>

<p>When <code>$coderef</code> is omitted or undefined, any existing callback will be removed and <code>decode</code> will not change the deserialised hash in any way.</p>

<p>Example, convert all JSON objects into the integer 5:</p>

<pre><code>my $js = JSON::PP-&gt;new-&gt;filter_json_object(sub { 5 });
# returns [5]
$js-&gt;decode(&#39;[{}]&#39;);
# returns 5
$js-&gt;decode(&#39;{&quot;a&quot;:1, &quot;b&quot;:2}&#39;);</code></pre>

<h2 id="filter_json_single_key_object"><a class="permalink" href="./JSON::PP.html#filter_json_single_key_object">#</a>filter_json_single_key_object</h2>

<pre><code>$json = $json-&gt;filter_json_single_key_object($key [=&gt; $coderef])</code></pre>

<p>Works remotely similar to <code>filter_json_object</code>, but is only called for JSON objects having a single key named <code>$key</code>.</p>

<p>This <code>$coderef</code> is called before the one specified via <code>filter_json_object</code>, if any. It gets passed the single value in the JSON object. If it returns a single value, it will be inserted into the data structure. If it returns nothing (not even <code>undef</code> but the empty list), the callback from <code>filter_json_object</code> will be called next, as if no single-key callback were specified.</p>

<p>If <code>$coderef</code> is omitted or undefined, the corresponding callback will be disabled. There can only ever be one callback for a given key.</p>

<p>As this callback gets called less often then the <code>filter_json_object</code> one, decoding speed will not usually suffer as much. Therefore, single-key objects make excellent targets to serialise Perl objects into, especially as single-key JSON objects are as close to the type-tagged value concept as JSON gets (it&#39;s basically an ID/VALUE tuple). Of course, JSON does not support this in any way, so you need to make sure your data never looks like a serialised Perl hash.</p>

<p>Typical names for the single object key are <code>__class_whatever__</code>, or <code>$__dollars_are_rarely_used__$</code> or <code>}ugly_brace_placement</code>, or even things like <code>__class_md5sum(classname)__</code>, to reduce the risk of clashing with real hashes.</p>

<p>Example, decode JSON objects of the form <code>{ &quot;__widget__&quot; =&gt; &lt;id&gt; }</code> into the corresponding <code>$WIDGET{&lt;id&gt;}</code> object:</p>

<pre><code># return whatever is in $WIDGET{5}:
JSON::PP
   -&gt;new
   -&gt;filter_json_single_key_object (__widget__ =&gt; sub {
         $WIDGET{ $_[0] }
      })
   -&gt;decode (&#39;{&quot;__widget__&quot;: 5&#39;)

# this can be used with a TO_JSON method in some &quot;widget&quot; class
# for serialisation to json:
sub WidgetBase::TO_JSON {
   my ($self) = @_;

   unless ($self-&gt;{id}) {
      $self-&gt;{id} = ..get..some..id..;
      $WIDGET{$self-&gt;{id}} = $self;
   }

   { __widget__ =&gt; $self-&gt;{id} }
}</code></pre>

<h2 id="shrink"><a class="permalink" href="./JSON::PP.html#shrink">#</a>shrink</h2>

<pre><code>$json = $json-&gt;shrink([$enable])

$enabled = $json-&gt;get_shrink</code></pre>

<p>If <code>$enable</code> is true (or missing), the string returned by <code>encode</code> will be shrunk (i.e. downgraded if possible).</p>

<p>The actual definition of what shrink does might change in future versions, but it will always try to save space at the expense of time.</p>

<p>If <code>$enable</code> is false, then JSON::PP does nothing.</p>

<h2 id="max_depth"><a class="permalink" href="./JSON::PP.html#max_depth">#</a>max_depth</h2>

<pre><code>$json = $json-&gt;max_depth([$maximum_nesting_depth])

$max_depth = $json-&gt;get_max_depth</code></pre>

<p>Sets the maximum nesting level (default <code>512</code>) accepted while encoding or decoding. If a higher nesting level is detected in JSON text or a Perl data structure, then the encoder and decoder will stop and croak at that point.</p>

<p>Nesting level is defined by number of hash- or arrayrefs that the encoder needs to traverse to reach a given point or the number of <code>{</code> or <code>[</code> characters without their matching closing parenthesis crossed to reach a given character in a string.</p>

<p>Setting the maximum depth to one disallows any nesting, so that ensures that the object is only a single hash/object or array.</p>

<p>If no argument is given, the highest possible setting will be used, which is rarely useful.</p>

<p>See <a href="./JSON::XS.html#SECURITY-CONSIDERATIONS">&quot;SECURITY CONSIDERATIONS&quot; in JSON::XS</a> for more info on why this is useful.</p>

<h2 id="max_size"><a class="permalink" href="./JSON::PP.html#max_size">#</a>max_size</h2>

<pre><code>$json = $json-&gt;max_size([$maximum_string_size])

$max_size = $json-&gt;get_max_size</code></pre>

<p>Set the maximum length a JSON text may have (in bytes) where decoding is being attempted. The default is <code>0</code>, meaning no limit. When <code>decode</code> is called on a string that is longer then this many bytes, it will not attempt to decode the string but throw an exception. This setting has no effect on <code>encode</code> (yet).</p>

<p>If no argument is given, the limit check will be deactivated (same as when <code>0</code> is specified).</p>

<p>See <a href="./JSON::XS.html#SECURITY-CONSIDERATIONS">&quot;SECURITY CONSIDERATIONS&quot; in JSON::XS</a> for more info on why this is useful.</p>

<h2 id="encode"><a class="permalink" href="./JSON::PP.html#encode">#</a>encode</h2>

<pre><code>$json_text = $json-&gt;encode($perl_scalar)</code></pre>

<p>Converts the given Perl value or data structure to its JSON representation. Croaks on error.</p>

<h2 id="decode"><a class="permalink" href="./JSON::PP.html#decode">#</a>decode</h2>

<pre><code>$perl_scalar = $json-&gt;decode($json_text)</code></pre>

<p>The opposite of <code>encode</code>: expects a JSON text and tries to parse it, returning the resulting simple scalar or reference. Croaks on error.</p>

<h2 id="decode_prefix"><a class="permalink" href="./JSON::PP.html#decode_prefix">#</a>decode_prefix</h2>

<pre><code>($perl_scalar, $characters) = $json-&gt;decode_prefix($json_text)</code></pre>

<p>This works like the <code>decode</code> method, but instead of raising an exception when there is trailing garbage after the first JSON object, it will silently stop parsing there and return the number of characters consumed so far.</p>

<p>This is useful if your JSON texts are not delimited by an outer protocol and you need to know where the JSON text ends.</p>

<pre><code>JSON::PP-&gt;new-&gt;decode_prefix (&quot;[1] the tail&quot;)
=&gt; ([1], 3)</code></pre>

<h1 id="FLAGS-FOR-JSON::PP-ONLY"><a class="permalink" href="./JSON::PP.html#FLAGS-FOR-JSON::PP-ONLY">#</a><a id="FLAGS"></a>FLAGS FOR JSON::PP ONLY</h1>

<p>The following flags and properties are for JSON::PP only. If you use any of these, you can&#39;t make your application run faster by replacing JSON::PP with JSON::XS. If you need these and also speed boost, you might want to try <a href="./Cpanel::JSON::XS.html">Cpanel::JSON::XS</a>, a fork of JSON::XS by Reini Urban, which supports some of these (with a different set of incompatibilities). Most of these historical flags are only kept for backward compatibility, and should not be used in a new application.</p>

<h2 id="allow_singlequote"><a class="permalink" href="./JSON::PP.html#allow_singlequote">#</a>allow_singlequote</h2>

<pre><code>$json = $json-&gt;allow_singlequote([$enable])
$enabled = $json-&gt;get_allow_singlequote</code></pre>

<p>If <code>$enable</code> is true (or missing), then <code>decode</code> will accept invalid JSON texts that contain strings that begin and end with single quotation marks. <code>encode</code> will not be affected in any way. <i>Be aware that this option makes you accept invalid JSON texts as if they were valid!</i>. I suggest only to use this option to parse application-specific files written by humans (configuration files, resource files etc.)</p>

<p>If <code>$enable</code> is false (the default), then <code>decode</code> will only accept valid JSON texts.</p>

<pre><code>$json-&gt;allow_singlequote-&gt;decode(qq|{&quot;foo&quot;:&#39;bar&#39;}|);
$json-&gt;allow_singlequote-&gt;decode(qq|{&#39;foo&#39;:&quot;bar&quot;}|);
$json-&gt;allow_singlequote-&gt;decode(qq|{&#39;foo&#39;:&#39;bar&#39;}|);</code></pre>

<h2 id="allow_barekey"><a class="permalink" href="./JSON::PP.html#allow_barekey">#</a>allow_barekey</h2>

<pre><code>$json = $json-&gt;allow_barekey([$enable])
$enabled = $json-&gt;get_allow_barekey</code></pre>

<p>If <code>$enable</code> is true (or missing), then <code>decode</code> will accept invalid JSON texts that contain JSON objects whose names don&#39;t begin and end with quotation marks. <code>encode</code> will not be affected in any way. <i>Be aware that this option makes you accept invalid JSON texts as if they were valid!</i>. I suggest only to use this option to parse application-specific files written by humans (configuration files, resource files etc.)</p>

<p>If <code>$enable</code> is false (the default), then <code>decode</code> will only accept valid JSON texts.</p>

<pre><code>$json-&gt;allow_barekey-&gt;decode(qq|{foo:&quot;bar&quot;}|);</code></pre>

<h2 id="allow_bignum"><a class="permalink" href="./JSON::PP.html#allow_bignum">#</a>allow_bignum</h2>

<pre><code>$json = $json-&gt;allow_bignum([$enable])
$enabled = $json-&gt;get_allow_bignum</code></pre>

<p>If <code>$enable</code> is true (or missing), then <code>decode</code> will convert big integers Perl cannot handle as integer into <a href="./Math::BigInt.html">Math::BigInt</a> objects and convert floating numbers into <a href="./Math::BigFloat.html">Math::BigFloat</a> objects. <code>encode</code> will convert <code>Math::BigInt</code> and <code>Math::BigFloat</code> objects into JSON numbers.</p>

<pre><code>$json-&gt;allow_nonref-&gt;allow_bignum;
$bigfloat = $json-&gt;decode(&#39;2.000000000000000000000000001&#39;);
print $json-&gt;encode($bigfloat);
# =&gt; 2.000000000000000000000000001</code></pre>

<p>See also <a href="https://perldoc.perl.org/5.35.0/MAPPING">MAPPING</a>.</p>

<h2 id="loose"><a class="permalink" href="./JSON::PP.html#loose">#</a>loose</h2>

<pre><code>$json = $json-&gt;loose([$enable])
$enabled = $json-&gt;get_loose</code></pre>

<p>If <code>$enable</code> is true (or missing), then <code>decode</code> will accept invalid JSON texts that contain unescaped [\x00-\x1f\x22\x5c] characters. <code>encode</code> will not be affected in any way. <i>Be aware that this option makes you accept invalid JSON texts as if they were valid!</i>. I suggest only to use this option to parse application-specific files written by humans (configuration files, resource files etc.)</p>

<p>If <code>$enable</code> is false (the default), then <code>decode</code> will only accept valid JSON texts.</p>

<pre><code>$json-&gt;loose-&gt;decode(qq|[&quot;abc
                               def&quot;]|);</code></pre>

<h2 id="escape_slash"><a class="permalink" href="./JSON::PP.html#escape_slash">#</a>escape_slash</h2>

<pre><code>$json = $json-&gt;escape_slash([$enable])
$enabled = $json-&gt;get_escape_slash</code></pre>

<p>If <code>$enable</code> is true (or missing), then <code>encode</code> will explicitly escape <i>slash</i> (solidus; <code>U+002F</code>) characters to reduce the risk of XSS (cross site scripting) that may be caused by <code>&lt;/script&gt;</code> in a JSON text, with the cost of bloating the size of JSON texts.</p>

<p>This option may be useful when you embed JSON in HTML, but embedding arbitrary JSON in HTML (by some HTML template toolkit or by string interpolation) is risky in general. You must escape necessary characters in correct order, depending on the context.</p>

<p><code>decode</code> will not be affected in any way.</p>

<h2 id="indent_length"><a class="permalink" href="./JSON::PP.html#indent_length">#</a>indent_length</h2>

<pre><code>$json = $json-&gt;indent_length($number_of_spaces)
$length = $json-&gt;get_indent_length</code></pre>

<p>This option is only useful when you also enable <code>indent</code> or <code>pretty</code>.</p>

<p>JSON::XS indents with three spaces when you <code>encode</code> (if requested by <code>indent</code> or <code>pretty</code>), and the number cannot be changed. JSON::PP allows you to change/get the number of indent spaces with these mutator/accessor. The default number of spaces is three (the same as JSON::XS), and the acceptable range is from <code>0</code> (no indentation; it&#39;d be better to disable indentation by <code>indent(0)</code>) to <code>15</code>.</p>

<h2 id="sort_by"><a class="permalink" href="./JSON::PP.html#sort_by">#</a>sort_by</h2>

<pre><code>$json = $json-&gt;sort_by($code_ref)
$json = $json-&gt;sort_by($subroutine_name)</code></pre>

<p>If you just want to sort keys (names) in JSON objects when you <code>encode</code>, enable <code>canonical</code> option (see above) that allows you to sort object keys alphabetically.</p>

<p>If you do need to sort non-alphabetically for whatever reasons, you can give a code reference (or a subroutine name) to <code>sort_by</code>, then the argument will be passed to Perl&#39;s <code>sort</code> built-in function.</p>

<p>As the sorting is done in the JSON::PP scope, you usually need to prepend <code>JSON::PP::</code> to the subroutine name, and the special variables <code>$a</code> and <code>$b</code> used in the subrontine used by <code>sort</code> function.</p>

<p>Example:</p>

<pre><code>my %ORDER = (id =&gt; 1, class =&gt; 2, name =&gt; 3);
$json-&gt;sort_by(sub {
    ($ORDER{$JSON::PP::a} // 999) &lt;=&gt; ($ORDER{$JSON::PP::b} // 999)
    or $JSON::PP::a cmp $JSON::PP::b
});
print $json-&gt;encode([
    {name =&gt; &#39;CPAN&#39;, id =&gt; 1, href =&gt; &#39;http://cpan.org&#39;}
]);
# [{&quot;id&quot;:1,&quot;name&quot;:&quot;CPAN&quot;,&quot;href&quot;:&quot;http://cpan.org&quot;}]</code></pre>

<p>Note that <code>sort_by</code> affects all the plain hashes in the data structure. If you need finer control, <code>tie</code> necessary hashes with a module that implements ordered hash (such as <a href="./Hash::Ordered.html">Hash::Ordered</a> and <a href="./Tie::IxHash.html">Tie::IxHash</a>). <code>canonical</code> and <code>sort_by</code> don&#39;t affect the key order in <code>tie</code>d hashes.</p>

<pre><code>use Hash::Ordered;
tie my %hash, &#39;Hash::Ordered&#39;,
    (name =&gt; &#39;CPAN&#39;, id =&gt; 1, href =&gt; &#39;http://cpan.org&#39;);
print $json-&gt;encode([\%hash]);
# [{&quot;name&quot;:&quot;CPAN&quot;,&quot;id&quot;:1,&quot;href&quot;:&quot;http://cpan.org&quot;}] # order is kept</code></pre>

<h1 id="INCREMENTAL-PARSING"><a class="permalink" href="./JSON::PP.html#INCREMENTAL-PARSING">#</a><a id="INCREMENTAL"></a>INCREMENTAL PARSING</h1>

<p>This section is also taken from JSON::XS.</p>

<p>In some cases, there is the need for incremental parsing of JSON texts. While this module always has to keep both JSON text and resulting Perl data structure in memory at one time, it does allow you to parse a JSON stream incrementally. It does so by accumulating text until it has a full JSON object, which it then can decode. This process is similar to using <code>decode_prefix</code> to see if a full JSON object is available, but is much more efficient (and can be implemented with a minimum of method calls).</p>

<p>JSON::PP will only attempt to parse the JSON text once it is sure it has enough text to get a decisive result, using a very simple but truly incremental parser. This means that it sometimes won&#39;t stop as early as the full parser, for example, it doesn&#39;t detect mismatched parentheses. The only thing it guarantees is that it starts decoding as soon as a syntactically valid JSON text has been seen. This means you need to set resource limits (e.g. <code>max_size</code>) to ensure the parser will stop parsing in the presence if syntax errors.</p>

<p>The following methods implement this incremental parser.</p>

<h2 id="incr_parse"><a class="permalink" href="./JSON::PP.html#incr_parse">#</a>incr_parse</h2>

<pre><code>$json-&gt;incr_parse( [$string] ) # void context

$obj_or_undef = $json-&gt;incr_parse( [$string] ) # scalar context

@obj_or_empty = $json-&gt;incr_parse( [$string] ) # list context</code></pre>

<p>This is the central parsing function. It can both append new text and extract objects from the stream accumulated so far (both of these functions are optional).</p>

<p>If <code>$string</code> is given, then this string is appended to the already existing JSON fragment stored in the <code>$json</code> object.</p>

<p>After that, if the function is called in void context, it will simply return without doing anything further. This can be used to add more text in as many chunks as you want.</p>

<p>If the method is called in scalar context, then it will try to extract exactly <i>one</i> JSON object. If that is successful, it will return this object, otherwise it will return <code>undef</code>. If there is a parse error, this method will croak just as <code>decode</code> would do (one can then use <code>incr_skip</code> to skip the erroneous part). This is the most common way of using the method.</p>

<p>And finally, in list context, it will try to extract as many objects from the stream as it can find and return them, or the empty list otherwise. For this to work, there must be no separators (other than whitespace) between the JSON objects or arrays, instead they must be concatenated back-to-back. If an error occurs, an exception will be raised as in the scalar context case. Note that in this case, any previously-parsed JSON texts will be lost.</p>

<p>Example: Parse some JSON arrays/objects in a given string and return them.</p>

<pre><code>my @objs = JSON::PP-&gt;new-&gt;incr_parse (&quot;[5][7][1,2]&quot;);</code></pre>

<h2 id="incr_text"><a class="permalink" href="./JSON::PP.html#incr_text">#</a>incr_text</h2>

<pre><code>$lvalue_string = $json-&gt;incr_text</code></pre>

<p>This method returns the currently stored JSON fragment as an lvalue, that is, you can manipulate it. This <i>only</i> works when a preceding call to <code>incr_parse</code> in <i>scalar context</i> successfully returned an object. Under all other circumstances you must not call this function (I mean it. although in simple tests it might actually work, it <i>will</i> fail under real world conditions). As a special exception, you can also call this method before having parsed anything.</p>

<p>That means you can only use this function to look at or manipulate text before or after complete JSON objects, not while the parser is in the middle of parsing a JSON object.</p>

<p>This function is useful in two cases: a) finding the trailing text after a JSON object or b) parsing multiple JSON objects separated by non-JSON text (such as commas).</p>

<h2 id="incr_skip"><a class="permalink" href="./JSON::PP.html#incr_skip">#</a>incr_skip</h2>

<pre><code>$json-&gt;incr_skip</code></pre>

<p>This will reset the state of the incremental parser and will remove the parsed text from the input buffer so far. This is useful after <code>incr_parse</code> died, in which case the input buffer and incremental parser state is left unchanged, to skip the text parsed so far and to reset the parse state.</p>

<p>The difference to <code>incr_reset</code> is that only text until the parse error occurred is removed.</p>

<h2 id="incr_reset"><a class="permalink" href="./JSON::PP.html#incr_reset">#</a>incr_reset</h2>

<pre><code>$json-&gt;incr_reset</code></pre>

<p>This completely resets the incremental parser, that is, after this call, it will be as if the parser had never parsed anything.</p>

<p>This is useful if you want to repeatedly parse JSON objects and want to ignore any trailing data, which means you have to reset the parser after each successful decode.</p>

<h1 id="MAPPING"><a class="permalink" href="./JSON::PP.html#MAPPING">#</a>MAPPING</h1>

<p>Most of this section is also taken from JSON::XS.</p>

<p>This section describes how JSON::PP maps Perl values to JSON values and vice versa. These mappings are designed to &quot;do the right thing&quot; in most circumstances automatically, preserving round-tripping characteristics (what you put in comes out as something equivalent).</p>

<p>For the more enlightened: note that in the following descriptions, lowercase <i>perl</i> refers to the Perl interpreter, while uppercase <i>Perl</i> refers to the abstract Perl language itself.</p>

<h2 id="JSON-&gt;-PERL"><a class="permalink" href="./JSON::PP.html#JSON-%3E-PERL">#</a><a id="JSON1"></a><a id="JSON---PERL"></a>JSON -&gt; PERL</h2>

<dl>

<dt id="object"><a class="permalink" href="./JSON::PP.html#object">#</a>object</dt>
<dd>

<p>A JSON object becomes a reference to a hash in Perl. No ordering of object keys is preserved (JSON does not preserve object key ordering itself).</p>

</dd>
<dt id="array"><a class="permalink" href="./JSON::PP.html#array">#</a>array</dt>
<dd>

<p>A JSON array becomes a reference to an array in Perl.</p>

</dd>
<dt id="string"><a class="permalink" href="./JSON::PP.html#string">#</a>string</dt>
<dd>

<p>A JSON string becomes a string scalar in Perl - Unicode codepoints in JSON are represented by the same codepoints in the Perl string, so no manual decoding is necessary.</p>

</dd>
<dt id="number"><a class="permalink" href="./JSON::PP.html#number">#</a>number</dt>
<dd>

<p>A JSON number becomes either an integer, numeric (floating point) or string scalar in perl, depending on its range and any fractional parts. On the Perl level, there is no difference between those as Perl handles all the conversion details, but an integer may take slightly less memory and might represent more values exactly than floating point numbers.</p>

<p>If the number consists of digits only, JSON::PP will try to represent it as an integer value. If that fails, it will try to represent it as a numeric (floating point) value if that is possible without loss of precision. Otherwise it will preserve the number as a string value (in which case you lose roundtripping ability, as the JSON number will be re-encoded to a JSON string).</p>

<p>Numbers containing a fractional or exponential part will always be represented as numeric (floating point) values, possibly at a loss of precision (in which case you might lose perfect roundtripping ability, but the JSON number will still be re-encoded as a JSON number).</p>

<p>Note that precision is not accuracy - binary floating point values cannot represent most decimal fractions exactly, and when converting from and to floating point, JSON::PP only guarantees precision up to but not including the least significant bit.</p>

<p>When <code>allow_bignum</code> is enabled, big integer values and any numeric values will be converted into <a href="./Math::BigInt.html">Math::BigInt</a> and <a href="./Math::BigFloat.html">Math::BigFloat</a> objects respectively, without becoming string scalars or losing precision.</p>

</dd>
<dt id="true,-false"><a class="permalink" href="./JSON::PP.html#true,-false">#</a><a id="true"></a><a id="true-false"></a>true, false</dt>
<dd>

<p>These JSON atoms become <code>JSON::PP::true</code> and <code>JSON::PP::false</code>, respectively. They are overloaded to act almost exactly like the numbers <code>1</code> and <code>0</code>. You can check whether a scalar is a JSON boolean by using the <code>JSON::PP::is_bool</code> function.</p>

</dd>
<dt id="null"><a class="permalink" href="./JSON::PP.html#null">#</a>null</dt>
<dd>

<p>A JSON null atom becomes <code>undef</code> in Perl.</p>

</dd>
<dt id="shell-style-comments-(#-text)"><a class="permalink" href="./JSON::PP.html#shell-style-comments-(%23-text)">#</a><a id="shell"></a><a id="shell-style-comments-text"></a>shell-style comments (<code># <i>text</i></code>)</dt>
<dd>

<p>As a nonstandard extension to the JSON syntax that is enabled by the <code>relaxed</code> setting, shell-style comments are allowed. They can start anywhere outside strings and go till the end of the line.</p>

</dd>
<dt id="tagged-values-((tag)value)."><a class="permalink" href="./JSON::PP.html#tagged-values-((tag)value).">#</a><a id="tagged"></a><a id="tagged-values-tag-value"></a>tagged values (<code>(<i>tag</i>)<i>value</i></code>).</dt>
<dd>

<p>Another nonstandard extension to the JSON syntax, enabled with the <code>allow_tags</code> setting, are tagged values. In this implementation, the <i>tag</i> must be a perl package/class name encoded as a JSON string, and the <i>value</i> must be a JSON array encoding optional constructor arguments.</p>

<p>See <a href="./JSON::PP.html#OBJECT-SERIALISATION">&quot;OBJECT SERIALISATION&quot;</a>, below, for details.</p>

</dd>
</dl>

<h2 id="PERL-&gt;-JSON"><a class="permalink" href="./JSON::PP.html#PERL-%3E-JSON">#</a><a id="PERL"></a><a id="PERL---JSON"></a>PERL -&gt; JSON</h2>

<p>The mapping from Perl to JSON is slightly more difficult, as Perl is a truly typeless language, so we can only guess which JSON type is meant by a Perl value.</p>

<dl>

<dt id="hash-references"><a class="permalink" href="./JSON::PP.html#hash-references">#</a><a id="hash"></a>hash references</dt>
<dd>

<p>Perl hash references become JSON objects. As there is no inherent ordering in hash keys (or JSON objects), they will usually be encoded in a pseudo-random order. JSON::PP can optionally sort the hash keys (determined by the <i>canonical</i> flag and/or <i>sort_by</i> property), so the same data structure will serialise to the same JSON text (given same settings and version of JSON::PP), but this incurs a runtime overhead and is only rarely useful, e.g. when you want to compare some JSON text against another for equality.</p>

</dd>
<dt id="array-references"><a class="permalink" href="./JSON::PP.html#array-references">#</a><a id="array1"></a>array references</dt>
<dd>

<p>Perl array references become JSON arrays.</p>

</dd>
<dt id="other-references"><a class="permalink" href="./JSON::PP.html#other-references">#</a><a id="other"></a>other references</dt>
<dd>

<p>Other unblessed references are generally not allowed and will cause an exception to be thrown, except for references to the integers <code>0</code> and <code>1</code>, which get turned into <code>false</code> and <code>true</code> atoms in JSON. You can also use <code>JSON::PP::false</code> and <code>JSON::PP::true</code> to improve readability.</p>

<pre><code class="plaintext">to_json [\0, JSON::PP::true]      # yields [false,true]</code></pre>

</dd>
<dt id="JSON::PP::true,-JSON::PP::false"><a class="permalink" href="./JSON::PP.html#JSON::PP::true,-JSON::PP::false">#</a><a id="JSON2"></a><a id="JSON::PP::true-JSON::PP::false"></a>JSON::PP::true, JSON::PP::false</dt>
<dd>

<p>These special values become JSON true and JSON false values, respectively. You can also use <code>\1</code> and <code>\0</code> directly if you want.</p>

</dd>
<dt id="JSON::PP::null"><a class="permalink" href="./JSON::PP.html#JSON::PP::null">#</a><a id="JSON3"></a>JSON::PP::null</dt>
<dd>

<p>This special value becomes JSON null.</p>

</dd>
<dt id="blessed-objects"><a class="permalink" href="./JSON::PP.html#blessed-objects">#</a><a id="blessed"></a>blessed objects</dt>
<dd>

<p>Blessed objects are not directly representable in JSON, but <code>JSON::PP</code> allows various ways of handling objects. See <a href="./JSON::PP.html#OBJECT-SERIALISATION">&quot;OBJECT SERIALISATION&quot;</a>, below, for details.</p>

</dd>
<dt id="simple-scalars"><a class="permalink" href="./JSON::PP.html#simple-scalars">#</a><a id="simple"></a>simple scalars</dt>
<dd>

<p>Simple Perl scalars (any scalar that is not a reference) are the most difficult objects to encode: JSON::PP will encode undefined scalars as JSON <code>null</code> values, scalars that have last been used in a string context before encoding as JSON strings, and anything else as number value:</p>

<pre><code># dump as number
encode_json [2]                      # yields [2]
encode_json [-3.0e17]                # yields [-3e+17]
my $value = 5; encode_json [$value]  # yields [5]

# used as string, so dump as string
print $value;
encode_json [$value]                 # yields [&quot;5&quot;]

# undef becomes null
encode_json [undef]                  # yields [null]</code></pre>

<p>You can force the type to be a JSON string by stringifying it:</p>

<pre><code>my $x = 3.1; # some variable containing a number
&quot;$x&quot;;        # stringified
$x .= &quot;&quot;;    # another, more awkward way to stringify
print $x;    # perl does it for you, too, quite often
             # (but for older perls)</code></pre>

<p>You can force the type to be a JSON number by numifying it:</p>

<pre><code>my $x = &quot;3&quot;; # some variable containing a string
$x += 0;     # numify it, ensuring it will be dumped as a number
$x *= 1;     # same thing, the choice is yours.</code></pre>

<p>You can not currently force the type in other, less obscure, ways.</p>

<p>Since version 2.91_01, JSON::PP uses a different number detection logic that converts a scalar that is possible to turn into a number safely. The new logic is slightly faster, and tends to help people who use older perl or who want to encode complicated data structure. However, this may results in a different JSON text from the one JSON::XS encodes (and thus may break tests that compare entire JSON texts). If you do need the previous behavior for compatibility or for finer control, set PERL_JSON_PP_USE_B environmental variable to true before you <code>use</code> JSON::PP (or JSON.pm).</p>

<p>Note that numerical precision has the same meaning as under Perl (so binary to decimal conversion follows the same rules as in Perl, which can differ to other languages). Also, your perl interpreter might expose extensions to the floating point numbers of your platform, such as infinities or NaN&#39;s - these cannot be represented in JSON, and it is an error to pass those in.</p>

<p>JSON::PP (and JSON::XS) trusts what you pass to <code>encode</code> method (or <code>encode_json</code> function) is a clean, validated data structure with values that can be represented as valid JSON values only, because it&#39;s not from an external data source (as opposed to JSON texts you pass to <code>decode</code> or <code>decode_json</code>, which JSON::PP considers tainted and doesn&#39;t trust). As JSON::PP doesn&#39;t know exactly what you and consumers of your JSON texts want the unexpected values to be (you may want to convert them into null, or to stringify them with or without normalisation (string representation of infinities/NaN may vary depending on platforms), or to croak without conversion), you&#39;re advised to do what you and your consumers need before you encode, and also not to numify values that may start with values that look like a number (including infinities/NaN), without validating.</p>

</dd>
</dl>

<h2 id="OBJECT-SERIALISATION"><a class="permalink" href="./JSON::PP.html#OBJECT-SERIALISATION">#</a><a id="OBJECT1"></a>OBJECT SERIALISATION</h2>

<p>As JSON cannot directly represent Perl objects, you have to choose between a pure JSON representation (without the ability to deserialise the object automatically again), and a nonstandard extension to the JSON syntax, tagged values.</p>

<h3 id="SERIALISATION"><a class="permalink" href="./JSON::PP.html#SERIALISATION">#</a>SERIALISATION</h3>

<p>What happens when <code>JSON::PP</code> encounters a Perl object depends on the <code>allow_blessed</code>, <code>convert_blessed</code>, <code>allow_tags</code> and <code>allow_bignum</code> settings, which are used in this order:</p>

<dl>

<dt id="1.-allow_tags-is-enabled-and-the-object-has-a-FREEZE-method."><a class="permalink" href="./JSON::PP.html#1.-allow_tags-is-enabled-and-the-object-has-a-FREEZE-method.">#</a><a id="1"></a><a id="allow_tags-is-enabled-and-the-object-has-a-FREEZE-method"></a>1. <code>allow_tags</code> is enabled and the object has a <code>FREEZE</code> method.</dt>
<dd>

<p>In this case, <code>JSON::PP</code> creates a tagged JSON value, using a nonstandard extension to the JSON syntax.</p>

<p>This works by invoking the <code>FREEZE</code> method on the object, with the first argument being the object to serialise, and the second argument being the constant string <code>JSON</code> to distinguish it from other serialisers.</p>

<p>The <code>FREEZE</code> method can return any number of values (i.e. zero or more). These values and the paclkage/classname of the object will then be encoded as a tagged JSON value in the following format:</p>

<pre><code class="plaintext">(&quot;classname&quot;)[FREEZE return values...]</code></pre>

<p>e.g.:</p>

<pre><code class="plaintext">(&quot;URI&quot;)[&quot;http://www.google.com/&quot;]
(&quot;MyDate&quot;)[2013,10,29]
(&quot;ImageData::JPEG&quot;)[&quot;Z3...VlCg==&quot;]</code></pre>

<p>For example, the hypothetical <code>My::Object</code> <code>FREEZE</code> method might use the objects <code>type</code> and <code>id</code> members to encode the object:</p>

<pre><code>sub My::Object::FREEZE {
   my ($self, $serialiser) = @_;

   ($self-&gt;{type}, $self-&gt;{id})
}</code></pre>

</dd>
<dt id="2.-convert_blessed-is-enabled-and-the-object-has-a-TO_JSON-method."><a class="permalink" href="./JSON::PP.html#2.-convert_blessed-is-enabled-and-the-object-has-a-TO_JSON-method.">#</a><a id="2"></a><a id="convert_blessed-is-enabled-and-the-object-has-a-TO_JSON-method"></a>2. <code>convert_blessed</code> is enabled and the object has a <code>TO_JSON</code> method.</dt>
<dd>

<p>In this case, the <code>TO_JSON</code> method of the object is invoked in scalar context. It must return a single scalar that can be directly encoded into JSON. This scalar replaces the object in the JSON text.</p>

<p>For example, the following <code>TO_JSON</code> method will convert all <a href="URI.html">URI</a> objects to JSON strings when serialised. The fact that these values originally were <a href="URI.html">URI</a> objects is lost.</p>

<pre><code>sub URI::TO_JSON {
   my ($uri) = @_;
   $uri-&gt;as_string
}</code></pre>

</dd>
<dt id="3.-allow_bignum-is-enabled-and-the-object-is-a-Math::BigInt-or-Math::BigFloat."><a class="permalink" href="./JSON::PP.html#3.-allow_bignum-is-enabled-and-the-object-is-a-Math::BigInt-or-Math::BigFloat.">#</a><a id="3"></a><a id="allow_bignum-is-enabled-and-the-object-is-a-Math::BigInt-or-Math::BigFloat"></a>3. <code>allow_bignum</code> is enabled and the object is a <code>Math::BigInt</code> or <code>Math::BigFloat</code>.</dt>
<dd>

<p>The object will be serialised as a JSON number value.</p>

</dd>
<dt id="4.-allow_blessed-is-enabled."><a class="permalink" href="./JSON::PP.html#4.-allow_blessed-is-enabled.">#</a><a id="4"></a><a id="allow_blessed-is-enabled"></a>4. <code>allow_blessed</code> is enabled.</dt>
<dd>

<p>The object will be serialised as a JSON null value.</p>

</dd>
<dt id="5.-none-of-the-above"><a class="permalink" href="./JSON::PP.html#5.-none-of-the-above">#</a><a id="5"></a><a id="none-of-the-above"></a>5. none of the above</dt>
<dd>

<p>If none of the settings are enabled or the respective methods are missing, <code>JSON::PP</code> throws an exception.</p>

</dd>
</dl>

<h3 id="DESERIALISATION"><a class="permalink" href="./JSON::PP.html#DESERIALISATION">#</a>DESERIALISATION</h3>

<p>For deserialisation there are only two cases to consider: either nonstandard tagging was used, in which case <code>allow_tags</code> decides, or objects cannot be automatically be deserialised, in which case you can use postprocessing or the <code>filter_json_object</code> or <code>filter_json_single_key_object</code> callbacks to get some real objects our of your JSON.</p>

<p>This section only considers the tagged value case: a tagged JSON object is encountered during decoding and <code>allow_tags</code> is disabled, a parse error will result (as if tagged values were not part of the grammar).</p>

<p>If <code>allow_tags</code> is enabled, <code>JSON::PP</code> will look up the <code>THAW</code> method of the package/classname used during serialisation (it will not attempt to load the package as a Perl module). If there is no such method, the decoding will fail with an error.</p>

<p>Otherwise, the <code>THAW</code> method is invoked with the classname as first argument, the constant string <code>JSON</code> as second argument, and all the values from the JSON array (the values originally returned by the <code>FREEZE</code> method) as remaining arguments.</p>

<p>The method must then return the object. While technically you can return any Perl scalar, you might have to enable the <code>allow_nonref</code> setting to make that work in all cases, so better return an actual blessed reference.</p>

<p>As an example, let&#39;s implement a <code>THAW</code> function that regenerates the <code>My::Object</code> from the <code>FREEZE</code> example earlier:</p>

<pre><code>sub My::Object::THAW {
   my ($class, $serialiser, $type, $id) = @_;

   $class-&gt;new (type =&gt; $type, id =&gt; $id)
}</code></pre>

<h1 id="ENCODING/CODESET-FLAG-NOTES"><a class="permalink" href="./JSON::PP.html#ENCODING/CODESET-FLAG-NOTES">#</a><a id="ENCODING"></a><a id="ENCODING-CODESET-FLAG-NOTES"></a>ENCODING/CODESET FLAG NOTES</h1>

<p>This section is taken from JSON::XS.</p>

<p>The interested reader might have seen a number of flags that signify encodings or codesets - <code>utf8</code>, <code>latin1</code> and <code>ascii</code>. There seems to be some confusion on what these do, so here is a short comparison:</p>

<p><code>utf8</code> controls whether the JSON text created by <code>encode</code> (and expected by <code>decode</code>) is UTF-8 encoded or not, while <code>latin1</code> and <code>ascii</code> only control whether <code>encode</code> escapes character values outside their respective codeset range. Neither of these flags conflict with each other, although some combinations make less sense than others.</p>

<p>Care has been taken to make all flags symmetrical with respect to <code>encode</code> and <code>decode</code>, that is, texts encoded with any combination of these flag values will be correctly decoded when the same flags are used - in general, if you use different flag settings while encoding vs. when decoding you likely have a bug somewhere.</p>

<p>Below comes a verbose discussion of these flags. Note that a &quot;codeset&quot; is simply an abstract set of character-codepoint pairs, while an encoding takes those codepoint numbers and <i>encodes</i> them, in our case into octets. Unicode is (among other things) a codeset, UTF-8 is an encoding, and ISO-8859-1 (= latin 1) and ASCII are both codesets <i>and</i> encodings at the same time, which can be confusing.</p>

<dl>

<dt id="utf8-flag-disabled"><a class="permalink" href="./JSON::PP.html#utf8-flag-disabled">#</a><a id="utf81"></a><code>utf8</code> flag disabled</dt>
<dd>

<p>When <code>utf8</code> is disabled (the default), then <code>encode</code>/<code>decode</code> generate and expect Unicode strings, that is, characters with high ordinal Unicode values (&gt; 255) will be encoded as such characters, and likewise such characters are decoded as-is, no changes to them will be done, except &quot;(re-)interpreting&quot; them as Unicode codepoints or Unicode characters, respectively (to Perl, these are the same thing in strings unless you do funny/weird/dumb stuff).</p>

<p>This is useful when you want to do the encoding yourself (e.g. when you want to have UTF-16 encoded JSON texts) or when some other layer does the encoding for you (for example, when printing to a terminal using a filehandle that transparently encodes to UTF-8 you certainly do NOT want to UTF-8 encode your data first and have Perl encode it another time).</p>

</dd>
<dt id="utf8-flag-enabled"><a class="permalink" href="./JSON::PP.html#utf8-flag-enabled">#</a><a id="utf82"></a><code>utf8</code> flag enabled</dt>
<dd>

<p>If the <code>utf8</code>-flag is enabled, <code>encode</code>/<code>decode</code> will encode all characters using the corresponding UTF-8 multi-byte sequence, and will expect your input strings to be encoded as UTF-8, that is, no &quot;character&quot; of the input string must have any value &gt; 255, as UTF-8 does not allow that.</p>

<p>The <code>utf8</code> flag therefore switches between two modes: disabled means you will get a Unicode string in Perl, enabled means you get an UTF-8 encoded octet/binary string in Perl.</p>

</dd>
<dt id="latin1-or-ascii-flags-enabled"><a class="permalink" href="./JSON::PP.html#latin1-or-ascii-flags-enabled">#</a><a id="latin11"></a><code>latin1</code> or <code>ascii</code> flags enabled</dt>
<dd>

<p>With <code>latin1</code> (or <code>ascii</code>) enabled, <code>encode</code> will escape characters with ordinal values &gt; 255 (&gt; 127 with <code>ascii</code>) and encode the remaining characters as specified by the <code>utf8</code> flag.</p>

<p>If <code>utf8</code> is disabled, then the result is also correctly encoded in those character sets (as both are proper subsets of Unicode, meaning that a Unicode string with all character values &lt; 256 is the same thing as a ISO-8859-1 string, and a Unicode string with all character values &lt; 128 is the same thing as an ASCII string in Perl).</p>

<p>If <code>utf8</code> is enabled, you still get a correct UTF-8-encoded string, regardless of these flags, just some more characters will be escaped using <code>\uXXXX</code> then before.</p>

<p>Note that ISO-8859-1-<i>encoded</i> strings are not compatible with UTF-8 encoding, while ASCII-encoded strings are. That is because the ISO-8859-1 encoding is NOT a subset of UTF-8 (despite the ISO-8859-1 <i>codeset</i> being a subset of Unicode), while ASCII is.</p>

<p>Surprisingly, <code>decode</code> will ignore these flags and so treat all input values as governed by the <code>utf8</code> flag. If it is disabled, this allows you to decode ISO-8859-1- and ASCII-encoded strings, as both strict subsets of Unicode. If it is enabled, you can correctly decode UTF-8 encoded strings.</p>

<p>So neither <code>latin1</code> nor <code>ascii</code> are incompatible with the <code>utf8</code> flag - they only govern when the JSON output engine escapes a character or not.</p>

<p>The main use for <code>latin1</code> is to relatively efficiently store binary data as JSON, at the expense of breaking compatibility with most JSON decoders.</p>

<p>The main use for <code>ascii</code> is to force the output to not contain characters with values &gt; 127, which means you can interpret the resulting string as UTF-8, ISO-8859-1, ASCII, KOI8-R or most about any character set and 8-bit-encoding, and still get the same data structure back. This is useful when your channel for JSON transfer is not 8-bit clean or the encoding might be mangled in between (e.g. in mail), and works because ASCII is a proper subset of most 8-bit and multibyte encodings in use in the world.</p>

</dd>
</dl>

<h1 id="BUGS"><a class="permalink" href="./JSON::PP.html#BUGS">#</a>BUGS</h1>

<p>Please report bugs on a specific behavior of this module to RT or GitHub issues (preferred):</p>

<p><a href="https://github.com/makamaka/JSON-PP/issues">https://github.com/makamaka/JSON-PP/issues</a></p>

<p><a href="https://rt.cpan.org/Public/Dist/Display.html?Queue=JSON-PP">https://rt.cpan.org/Public/Dist/Display.html?Queue=JSON-PP</a></p>

<p>As for new features and requests to change common behaviors, please ask the author of JSON::XS (Marc Lehmann, &lt;schmorp[at]schmorp.de&gt;) first, by email (important!), to keep compatibility among JSON.pm backends.</p>

<p>Generally speaking, if you need something special for you, you are advised to create a new module, maybe based on <a href="./JSON::Tiny.html">JSON::Tiny</a>, which is smaller and written in a much cleaner way than this module.</p>

<h1 id="SEE-ALSO"><a class="permalink" href="./JSON::PP.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<p>The <i>json_pp</i> command line utility for quick experiments.</p>

<p><a href="./JSON::XS.html">JSON::XS</a>, <a href="./Cpanel::JSON::XS.html">Cpanel::JSON::XS</a>, and <a href="./JSON::Tiny.html">JSON::Tiny</a> for faster alternatives. <a href="JSON.html">JSON</a> and <a href="./JSON::MaybeXS.html">JSON::MaybeXS</a> for easy migration.</p>

<p><a href="./JSON::PP::Compat5005.html">JSON::PP::Compat5005</a> and <a href="./JSON::PP::Compat5006.html">JSON::PP::Compat5006</a> for older perl users.</p>

<p>RFC4627 (<a href="http://www.ietf.org/rfc/rfc4627.txt">http://www.ietf.org/rfc/rfc4627.txt</a>)</p>

<p>RFC7159 (<a href="http://www.ietf.org/rfc/rfc7159.txt">http://www.ietf.org/rfc/rfc7159.txt</a>)</p>

<p>RFC8259 (<a href="http://www.ietf.org/rfc/rfc8259.txt">http://www.ietf.org/rfc/rfc8259.txt</a>)</p>

<h1 id="AUTHOR"><a class="permalink" href="./JSON::PP.html#AUTHOR">#</a>AUTHOR</h1>

<p>Makamaka Hannyaharamitu, &lt;makamaka[at]cpan.org&gt;</p>

<h1 id="CURRENT-MAINTAINER"><a class="permalink" href="./JSON::PP.html#CURRENT-MAINTAINER">#</a><a id="CURRENT"></a>CURRENT MAINTAINER</h1>

<p>Kenichi Ishigaki, &lt;ishigaki[at]cpan.org&gt;</p>

<h1 id="COPYRIGHT-AND-LICENSE"><a class="permalink" href="./JSON::PP.html#COPYRIGHT-AND-LICENSE">#</a><a id="COPYRIGHT"></a>COPYRIGHT AND LICENSE</h1>

<p>Copyright 2007-2016 by Makamaka Hannyaharamitu</p>

<p>Most of the documentation is taken from JSON::XS by Marc Lehmann</p>

<p>This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
